cmake_minimum_required(VERSION 3.16)
project(test)

set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
    message(STATUS "CMAKE_BUILD_TYPE is not specified. Using default: ${CMAKE_BUILD_TYPE}")
endif()

# set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -Og -D_DEBUG -g -ggdb")
# set(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -Og -D_DEBUG -g -ggdb")

# set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -DNDEBUG -O3")
# set(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS}  -DNDEBUG -O3")

# set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "$ENV{CXXFLAGS}  -DNDEBUG -O2")
# set(CMAKE_C_FLAGS_RELWITHDEBINFO "$ENV{CFLAGS}  -DNDEBUG -O2")

# set(CMAKE_CXX_FLAGS_MINSIZEREL "$ENV{CXXFLAGS}  -DNDEBUG -Os")
# set(CMAKE_C_FLAGS_MINSIZEREL "$ENV{CFLAGS}  -DNDEBUG -Os")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines")

add_compile_options(-fPIC)
add_compile_options(-Wall)
add_compile_options(-std=c++20)

set(OS_NAME_ID ${OS_NAME}${OS_VER_ID})

#----------------------------  宏 定义 -----------------------------------
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
add_definitions(-DFMT_HEADER_ONLY)

#-------------------- out put ---------------------------------------------
set(PROJECT_BINARY_DIR ${PROJECT_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)


set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib/${OS_NAME_ID}/${PLATFORM}/${CMAKE_BUILD_TYPE})

include_directories(
    ${PROJECT_SOURCE_DIR}/src
    ${PROJECT_SOURCE_DIR}/src/Coroutine
)

file(GLOB_RECURSE Coroutine "${PROJECT_SOURCE_DIR}/src/Coroutine/*.cpp" "${PROJECT_SOURCE_DIR}/src/Coroutine/*.h")

add_executable(test1 "${PROJECT_SOURCE_DIR}/src/Test/test1.cpp" ${Coroutine})
target_link_libraries(test1
    pthread
)

add_executable(test2 "${PROJECT_SOURCE_DIR}/src/Test/test2.cpp" ${Coroutine})
target_link_libraries(test2
    pthread
)

add_executable(test3 "${PROJECT_SOURCE_DIR}/src/Test/test3.cpp" ${Coroutine})
target_link_libraries(test3
    pthread
)

add_executable(test4 "${PROJECT_SOURCE_DIR}/src/Test/test4.cpp" ${Coroutine})
target_link_libraries(test4
    pthread
)

add_executable(test5 "${PROJECT_SOURCE_DIR}/src/Test/test5.cpp" ${Coroutine})
target_link_libraries(test5
    pthread
)

add_executable(test6 "${PROJECT_SOURCE_DIR}/src/Test/test6.cpp" ${Coroutine})
target_link_libraries(test6
    pthread
)